package com.cykj.enterprise.controller;

import com.cykj.common.dto.ResponseDTO;
import com.cykj.enterprise.vo.HrVO;
import com.cykj.enterprise.service.IRecruitService;
import com.cykj.enterprise.vo.RecruitInfoVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.enterprise.controller
 * @Author: 小白糖糖
 * @CreateTime: 2025-08-18 22:11
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/recruit")
public class RecruitController {
    @Autowired
    private IRecruitService recruitService;

    /**
    * @Description: 根据hrID，获取公司信息，查询是否完成企业资质审核
    * @Param: [hrId]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @GetMapping("/getHrInfo")
    @Operation(summary = "查询该Hr是否已经完成企业资质审核")
    @Parameter(name = "hrId",description = "人事ID",in = ParameterIn.QUERY)
    public ResponseDTO getHrInfo(){
        return recruitService.getHrInfo();
    }

    /**
    * @Description: 根据hr身份对应权限，查询发布的招聘信息
    * @Param: [hrVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @GetMapping("/recruitList")
    @Operation(summary = "根据hr身份对应权限，查询发布的招聘信息")
    public ResponseDTO getRecruitList(HrVO hrVO){
         return recruitService.getRecruitList(hrVO);
    }

    /**
    * @Description: 获取所有职位类型，用于新增职位
    * @Param: []
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @GetMapping("/jobType")
    @Operation(summary = "获取所有职位类型，用于新增职位")
    public ResponseDTO getJobTypeList(){
        return recruitService.getJobTypeList();
    }

    /**
    * @Description: 根据选择的职位类别，获取对应职位类别下的具体职位
    * @Param: [typeId]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @GetMapping("/specificJob")
    @Operation(summary = "根据选择的职位类别，获取对应职位类别下的具体职位")
    @Parameter(name = "typeId",description = "职位类别ID",in = ParameterIn.QUERY)
    public ResponseDTO getSpecificJobList(@RequestParam("typeId") Integer typeId){
        return recruitService.getSpecificJobList(typeId);
    }

    /**
    * @Description: 企业端发布招聘信息
    * @Param: [recruitInfoVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @PostMapping("/addRecruit")
    @Operation(summary = "企业端发布招聘信息" )
    public ResponseDTO addRecruit(@RequestBody RecruitInfoVO recruitInfoVO){
        return recruitService.addRecruit(recruitInfoVO);
    }

    /**
    * @Description: 企业端修改招聘信息
    * @Param: [recruitInfoVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @PutMapping("/updateRecruit")
    @Operation(summary = "企业端修改招聘信息")
    public ResponseDTO updateRecruit(@RequestBody RecruitInfoVO recruitInfoVO){
        return recruitService.updateRecruit(recruitInfoVO);
    }

    /**
    * @Description: 企业端删除招聘信息时，hr身份认证
    * @Param: [hrVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @PostMapping("/identityCheck")
    @Operation(summary = "企业端删除招聘信息时，hr身份认证")
    public ResponseDTO identityCheck(@RequestBody HrVO hrVO){
        return recruitService.identityCheck(hrVO);
    }

    /**
    * @Description: 企业端删除招聘信息
    * @Param: [recruitId]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @Operation(summary = "企业端删除招聘信息")
    @Parameter(name = "recruitId",description = "招聘信息ID",in = ParameterIn.PATH)
    @DeleteMapping("/deleteRecruit/{recruitId}")
    public ResponseDTO deleteRecruit(@PathVariable("recruitId") Integer recruitId){
        return recruitService.deleteRecruit(recruitId);
    }
}
